<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <h2>插槽作用域和默认值</h2>
    <son>{{ name }}</son>
    <son></son>
  </div>

  <script src="../vue3.js"></script>
  <script>
    // 插槽作用域：哪个组件的template就用哪个组件的变量

    // 插槽的默认值：就是slot标签中间写的内容就会作为插槽的默认值
    const {createApp} = Vue;

    const Son = {
      template: `
        <div>
          <div>这是子组件</div>
          <slot>lisi</slot>
        </div>
      `,
    }

    const app = createApp({
      data() {
        return {
          name: "zhangsan"
        }
      },
      components: {
        Son
      },
    });

    app.mount("#app");
  </script>
</body>
</html>